const schedule = require('node-schedule');
const request = require('request')

const  scheduleCronstyle = ()=>{
    schedule.scheduleJob('5 46 11 * * *',()=>{
        request({
            url: 'https://oapi.dingtalk.com/robot/send?access_token=8081443a7a63e387f449c351ea1db53190e24ab6e41e61927f61b79da65d4438',
            method: 'POST',
            headers: {//设置请求头
                "content-type": "application/json",
            },
            body:JSON.stringify(
                {
                    "msgtype": "text", 
                    "text": {
                        "content": "全体都有，预备冲～～"
                    }, 
                    "at": {
                        "isAtAll": true
                    }
                }
            )
        })
    }); 
    schedule.scheduleJob('5 47 11 * * *',()=>{
        request({
            url: 'https://oapi.dingtalk.com/robot/send?access_token=8081443a7a63e387f449c351ea1db53190e24ab6e41e61927f61b79da65d4438',
            method: 'POST',
            headers: {//设置请求头
                "content-type": "application/json",
            },
            body:JSON.stringify(
                {
                    "msgtype": "text", 
                    "text": {
                        "content": "吃饭"
                    }, 
                    "at": {
                        "isAtAll": true
                    }
                }
            )
        })
    }); 
}
const  scheduleCronstyle2 = ()=>{
    schedule.scheduleJob('5 45 17 * * *',()=>{
        request({
            url: 'https://oapi.dingtalk.com/robot/send?access_token=8081443a7a63e387f449c351ea1db53190e24ab6e41e61927f61b79da65d4438',
            method: 'POST',
            headers: {//设置请求头
                "content-type": "application/json",
            },
            body:JSON.stringify(
                {
                    "msgtype": "text", 
                    "text": {
                        "content": "全体都有，预备冲～～"
                    }, 
                    "at": {
                        "isAtAll": true
                    }
                }
            )
        })
    }); 
    schedule.scheduleJob('5 46 17 * * *',()=>{
        request({
            url: 'https://oapi.dingtalk.com/robot/send?access_token=8081443a7a63e387f449c351ea1db53190e24ab6e41e61927f61b79da65d4438',
            method: 'POST',
            headers: {//设置请求头
                "content-type": "application/json",
            },
            body:JSON.stringify(
                {
                    "msgtype": "text", 
                    "text": {
                        "content": "吃饭"
                    }, 
                    "at": {
                        "isAtAll": true
                    }
                }
            )
        })
    }); 
}
  
  scheduleCronstyle();
  scheduleCronstyle2();

